package com.sgb.kjwl.view.ui.adapter.power;

import android.content.Context;
import android.widget.TextView;

import com.sgb.kjwl.BR;
import com.sgb.kjwl.R;
import com.sgb.kjwl.model.entity.PowerEntity;
import com.swgk.core.recyclerview.adapter.BaseRecycleAdapter;
import com.swgk.core.recyclerview.adapter.ItemViewHolder;

import java.util.List;

public class PowerListAdapter extends BaseRecycleAdapter<PowerEntity> {
    //业绩
    private TextView achievementTv;
    //资质
    private TextView intelligenceTv;
    //备案人才
    private TextView personTv;

    public PowerListAdapter(Context context, List<PowerEntity> datas) {
        super(context, R.layout.item_power_list, datas);
    }

    @Override
    public void convert(ItemViewHolder holder, PowerEntity powerEntity) {
        holder.setBinding(BR.viewModel, powerEntity);
        achievementTv = holder.getItem().findViewById(R.id.achievement_tv);
        intelligenceTv = holder.getItem().findViewById(R.id.intelligence_tv);
        personTv = holder.getItem().findViewById(R.id.person_tv);

        String achive = powerEntity.getAchivenums() != null ? powerEntity.getAchivenums() + "" : "0";
        achievementTv.setText("工程业绩(" + achive + ")");

        String qual = powerEntity.getQualificationums() != null ? powerEntity.getQualificationums() + "" : "0";
        intelligenceTv.setText("资质数量(" + qual + ")");

        String person = powerEntity.getPersonums() != null ? powerEntity.getPersonums() + "" : "0";
        personTv.setText("备案人才(" + person + ")");
    }
}
